<?
if($_SESSION[ "authority"]!="admin" && false){
   include "../NIV/checkauthority.php"; 
}else{
    include 'Module/ContactModule.php';
    $module=new ContactModule();
?>
<table class="table-data" style="width: 959px;margin-top: 0px">
    <tr>
        <th>ID</th>
        <th>Name</th>
        <th style="min-width: 180px">
            Mail
        </th>
        <th>Phone</th>
        <th  style="width: 120px">
            Content
        </th>
        <th style="width: 120px">
            Insert
        </th>
        <th style="min-width: 120px">#</th>
    </tr>

<?
//organization
$n=0;
$gr="";
$data=$module->gets();
if($data==null){
    echo "<tr><td colspan='7' style='text-align:center'>No data to display</td></tr>";
}else foreach ($data as $r){
    $n++;
    
?>
    <tr class="id-head-row <?=$_REQUEST["type"]?><?=$r["id"]?>">
        <td><?=$r["id"]?></td>
        <td><?=$r["name"]?></td>
        <td><?=$r["mail"]?></td>
        <td><?=$r["phone"]?></td>
        <td><?=$r["content"]?></td>
        <td><?=$r["insert"]?></td>
        <td style="padding: 0;margin: 0;vertical-align: middle">
            
            
                <?
                if($_REQUEST["type"]=="trash"){
                    ?>
                <div class="icon16 hover50 tooltip" title="Restore"
                     onclick="restoretemplate('<?=$r["id"]?>');"
                     >
                    
                    <img src="./images/icon/gtk_undelete.png">
                </div>
                    <?
                }else{
                ?>
                <span class="action" style="margin-top: 3px">
                <div class="icon16 hover50 tooltip"
                        title="Delete"
                        onclick="deletetemplate('<?=$r["id"]?>');"
                        >
                    <img src="./images/icon/16/edit_delete.png">
                </div>
                </span>
                <?
                }
                ?>
            
        </td>
    </tr>
    <tr class="id-content-row <?=$_REQUEST["type"]?><?=$r["id"]?> hidden">
        <td colspan="8">
            <center>đang tải...<br/>
                Nếu trang không tự tải nội dung hãy ấn vào 
                <a class="loadding" href="javascript:show_item('<?=$r["id"]?>','<?=$_REQUEST["type"]?>');">đây</a> để tải lại.<br/>
                Hoặc ấn vào <a href="02_Admin_planners.php?Unit=template_detail&id=<?=$r["id"]?>">đây</a> để tải tại tab khác.
            </center>
        </td>
    </tr>
<?
}
?>
</table>
<?
}
?>
<div class="clear"></div>